
class BaseController:
    def __init__(self, *args, **kwargs):
        pass

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc_value, traceback):
        """
        异常处理    
        """
        if exc_type:
            print(f"Error: {exc_type}, {exc_value}, {traceback}")

    @staticmethod
    def response_data():
        return Response()
    

class Response:

    def __init__(self):
        self.code = 200
        self.msg = "success"
        self.data = {}

    @property
    def to_dict(self):
        return {
            "code": self.code,
            "data": self.data,
            "msg": self.msg
        }
